package com.sun.androidexerciseproject.widget.activity.ui;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomNavigationView;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;

import com.sun.androidexerciseproject.widget.R;
import com.sun.androidexerciseproject.widget.util.LogUtil;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 底部导航栏的Activity,改变文字的颜色,可以通过style中的colorPrimary来控制主要颜色是什么
 */
public class BottomNavigationActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_bottom_navigation);
    }

    private Pattern pattern = Pattern.compile("交易金额：(.*?)[\\n元]");
    private Pattern patternMoney = Pattern.compile("[^0-9.]");

    private void test() {
        String source = "尊敬的用户：\n\t您尾号9000的中信储蓄卡\n\n交易时间：5月15日 16:46\n交易类型：支付宝存入\n交易金额：人民币 9.97\n卡内余额：人民币 254,934.19 元\n\n☆邀您参与520话题PK，豪送520套电影票，还可抽取戴森吹风机哦～";
        String targetStr;
        LogUtil.log("getMoneyFromStr source " + source);
        Matcher matcher = pattern.matcher(source);
        if (matcher.find()) {
            source = matcher.group(1);
            LogUtil.log("getMoneyFromStr source1 " + source);
            source = matcher.group();
            LogUtil.log("getMoneyFromStr source2 " + source);
            Matcher matcherMoney = patternMoney.matcher(source);
            targetStr = matcherMoney.replaceAll("").trim();
            LogUtil.log("getMoneyFromStr targetStr " + targetStr);
        } else {
            LogUtil.log("kkPayResult getMoneyFromStr money null");
        }
    }
}
